/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sv.com.dizucar.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author 43579648
 */
@Entity
@Table(name = "CLIENTE", catalog = "", schema = "DIZUCAR")
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"),
    @NamedQuery(name = "Cliente.findByIdcliente", query = "SELECT c FROM Cliente c WHERE c.idcliente = :idcliente"),
    @NamedQuery(name = "Cliente.findByNombre", query = "SELECT c FROM Cliente c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Cliente.findByApellido", query = "SELECT c FROM Cliente c WHERE c.apellido = :apellido"),
    @NamedQuery(name = "Cliente.findByTelefonooficina", query = "SELECT c FROM Cliente c WHERE c.telefonooficina = :telefonooficina"),
    @NamedQuery(name = "Cliente.findByTelefonocelular", query = "SELECT c FROM Cliente c WHERE c.telefonocelular = :telefonocelular"),
    @NamedQuery(name = "Cliente.findByCorreo", query = "SELECT c FROM Cliente c WHERE c.correo = :correo"),
    @NamedQuery(name = "Cliente.findByRedessociales", query = "SELECT c FROM Cliente c WHERE c.redessociales = :redessociales"),
    @NamedQuery(name = "Cliente.findByTelefonocasa", query = "SELECT c FROM Cliente c WHERE c.telefonocasa = :telefonocasa"),
    @NamedQuery(name = "Cliente.findByLugarderecepcion", query = "SELECT c FROM Cliente c WHERE c.lugarderecepcion = :lugarderecepcion"),
    @NamedQuery(name = "Cliente.findByLugarderetiro", query = "SELECT c FROM Cliente c WHERE c.lugarderetiro = :lugarderetiro"),
    @NamedQuery(name = "Cliente.findByDui", query = "SELECT c FROM Cliente c WHERE c.dui = :dui"),
    @NamedQuery(name = "Cliente.findByNit", query = "SELECT c FROM Cliente c WHERE c.nit = :nit")})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDCLIENTE", nullable = false)
    private Integer idcliente;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 80)
    private String nombre;
    @Basic(optional = false)
    @Column(name = "APELLIDO", nullable = false, length = 80)
    private String apellido;
    @Basic(optional = false)
    @Column(name = "TELEFONOOFICINA", nullable = false)
    private long telefonooficina;
    @Basic(optional = false)
    @Column(name = "TELEFONOCELULAR", nullable = false)
    private long telefonocelular;
    @Basic(optional = false)
    @Column(name = "CORREO", nullable = false, length = 30)
    private String correo;
    @Basic(optional = false)
    @Column(name = "REDESSOCIALES", nullable = false, length = 30)
    private String redessociales;
    @Basic(optional = false)
    @Column(name = "TELEFONOCASA", nullable = false)
    private long telefonocasa;
    @Basic(optional = false)
    @Column(name = "LUGARDERECEPCION", nullable = false, length = 200)
    private String lugarderecepcion;
    @Basic(optional = false)
    @Column(name = "LUGARDERETIRO", nullable = false, length = 200)
    private String lugarderetiro;
    @Basic(optional = false)
    @Column(name = "DUI", nullable = false, length = 9)
    private String dui;
    @Basic(optional = false)
    @Column(name = "NIT", nullable = false, length = 14)
    private String nit;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente", fetch = FetchType.LAZY)
    private List<Venta> ventaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente", fetch = FetchType.LAZY)
    private List<Queja> quejaList;
    @JoinColumn(name = "IDCATEGORIA", referencedColumnName = "IDCATEGORIA", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Categoria categoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente", fetch = FetchType.LAZY)
    private List<ClientePotencial> clientePotencialList;

    public Cliente() {
    }

    public Cliente(Integer idcliente) {
        this.idcliente = idcliente;
    }

    public Cliente(Integer idcliente, String nombre, String apellido, long telefonooficina, long telefonocelular, String correo, String redessociales, long telefonocasa, String lugarderecepcion, String lugarderetiro, String dui, String nit) {
        this.idcliente = idcliente;
        this.nombre = nombre;
        this.apellido = apellido;
        this.telefonooficina = telefonooficina;
        this.telefonocelular = telefonocelular;
        this.correo = correo;
        this.redessociales = redessociales;
        this.telefonocasa = telefonocasa;
        this.lugarderecepcion = lugarderecepcion;
        this.lugarderetiro = lugarderetiro;
        this.dui = dui;
        this.nit = nit;
    }

    public Integer getIdcliente() {
        return idcliente;
    }

    public void setIdcliente(Integer idcliente) {
        this.idcliente = idcliente;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public long getTelefonooficina() {
        return telefonooficina;
    }

    public void setTelefonooficina(long telefonooficina) {
        this.telefonooficina = telefonooficina;
    }

    public long getTelefonocelular() {
        return telefonocelular;
    }

    public void setTelefonocelular(long telefonocelular) {
        this.telefonocelular = telefonocelular;
    }

    public String getCorreo() {
        return correo;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    public String getRedessociales() {
        return redessociales;
    }

    public void setRedessociales(String redessociales) {
        this.redessociales = redessociales;
    }

    public long getTelefonocasa() {
        return telefonocasa;
    }

    public void setTelefonocasa(long telefonocasa) {
        this.telefonocasa = telefonocasa;
    }

    public String getLugarderecepcion() {
        return lugarderecepcion;
    }

    public void setLugarderecepcion(String lugarderecepcion) {
        this.lugarderecepcion = lugarderecepcion;
    }

    public String getLugarderetiro() {
        return lugarderetiro;
    }

    public void setLugarderetiro(String lugarderetiro) {
        this.lugarderetiro = lugarderetiro;
    }

    public String getDui() {
        return dui;
    }

    public void setDui(String dui) {
        this.dui = dui;
    }

    public String getNit() {
        return nit;
    }

    public void setNit(String nit) {
        this.nit = nit;
    }

    public List<Venta> getVentaList() {
        return ventaList;
    }

    public void setVentaList(List<Venta> ventaList) {
        this.ventaList = ventaList;
    }

    public List<Queja> getQuejaList() {
        return quejaList;
    }

    public void setQuejaList(List<Queja> quejaList) {
        this.quejaList = quejaList;
    }

    public Categoria getCategoria() {
        return categoria;
    }

    public void setCategoria(Categoria categoria) {
        this.categoria = categoria;
    }

    public List<ClientePotencial> getClientePotencialList() {
        return clientePotencialList;
    }

    public void setClientePotencialList(List<ClientePotencial> clientePotencialList) {
        this.clientePotencialList = clientePotencialList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcliente != null ? idcliente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.idcliente == null && other.idcliente != null) || (this.idcliente != null && !this.idcliente.equals(other.idcliente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.dizucar.modelo.Cliente[idcliente=" + idcliente + "]";
    }

}
